package com.sitech.openapi.controller.Product;

import com.sitech.openapi.controller.AbstractController;
import com.sitech.openapi.domain.ProductOrder.ProductOrder;
import com.sitech.openapi.service.ProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;


@Api(tags = "产品订单相关控制层", description = "包含产品新装订单")
@RestController
@Slf4j
public class ProductController extends AbstractController {

    @Autowired
    ProductService productService;

    @PostMapping("/product")
    @ApiOperation(value = "产品新装", notes = "产品新装")
    public ResponseEntity<ProductOrder> queryTestByPara(@RequestBody ProductOrder productOrder,
                                                        @RequestHeader HttpHeaders headers) {
        log.info("入参消息头信息》》》》》》》》》》》》》》》" + headers.toString());
        log.info("入参----------------------------" + productOrder.toString());


        ProductOrder prodOrder = productService.dealProduct(productOrder);
        ResponseEntity<ProductOrder> res = new ResponseEntity<ProductOrder>(prodOrder, initOKHeader(headers), HttpStatus.OK);
        return res;
    }
}
